package com.wanxi.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(value = "响应类型",description = "用于描述响应对象")
public class ResultDTO {
    @ApiModelProperty(value = "响应值",example = "1")
    private Integer code;
    @ApiModelProperty(value = "响应信息",example = "success，error，filed")
    private String msg;
    @ApiModelProperty(value = "响应数据数量",example = "12")
    private Integer count;
    @ApiModelProperty(value = "响应的真实数据",example = "一个json字符串")
    private Object data;

    public static ResultDTO getDTO(int count, Object data) {
        return ResultDTO.builder()
                .data(data)
                .count(count)
                .code(0)
                .build();
    }

}
